﻿using Greg.XmlEditor.Business;
namespace Greg.XmlEditor.Presentation.Presenters
{
	public class DocumentPresenterFactory : IDocumentPresenterFactory
	{
		private readonly IDocumentService documentService;

		public DocumentPresenterFactory(IDocumentService documentService)
		{
			this.documentService = documentService;
		}

		public DocumentPresenter CreateDocument()
		{
			var document = this.documentService.Create();
			return new DocumentPresenter(document, this.documentService);
		}

		public DocumentPresenter LoadDocument(string fileName)
		{
			var document = this.documentService.Create();
			this.documentService.Load(document, fileName);
			return new DocumentPresenter(document, this.documentService);
		}
	}
}
